package com.zx.erp.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zx.erp.sys.bean.Module;
import com.zx.erp.sys.mapper.ModuleMapper;
import com.zx.erp.sys.service.ModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 作者信息
 * @since 2021-11-10
 */
@Service
public class ModuleServiceImpl extends ServiceImpl<ModuleMapper, Module> implements ModuleService {
    @Autowired
    private ModuleMapper mapper;

    @Override
    public List<Module> findAllParentModule(Integer jobId) {

        return mapper.findAllParentModule(jobId);
    }

    @Override
    public List<Module> selectAllModule(Integer jobId) {
        return mapper.selectAllModule(jobId);
    }

    @Override
    public List<Module> selectAllModule2(String mname, Integer mState) {
        QueryWrapper<Module> wrapper = new QueryWrapper<Module>();
        wrapper.like("MODULE_RNAME", mname).eq("MODULE_STATE", mState);
        List<Module> list = list(wrapper);
        return list;
    }

    @Override
    public List<Module> findAllParentModule2(Integer pstate) {
        QueryWrapper<Module> wrapper = new QueryWrapper<Module>();
        wrapper.eq("MODULE_STATE", pstate).eq("MODULE_PID", 0);
        List<Module> list = list(wrapper);
        return list;
    }
}
